<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>详情</title>
    <script src="/js/jquery/jquery-3.4.1.js"></script>
    <script src="/js/service/common.js"></script>
    <link rel="stylesheet" href="/css/common.css" type="text/css">
    <script>
        window.onload = () => {
            defaultBackPage();
            $.ajax({
                url: `/author/authorDetailById/${[[${res}]]}`,
                type: "GET",
                dataType: "json",
                success: function (json) {
                    if(json.code === 200){
                        let res = json.data;
                        let author = res.author;
                        let authorHtml = `<span>${author.author}</span>`;
                        if(author.zi){
                            authorHtml += ` 字<span>${author.zi}</span>`;
                        }
                        if(author.hao){
                            authorHtml += ` 号<span>${author.hao}</span>`;
                        }
                        if(author.dynasty){
                            authorHtml +=  ` <span>${author.dynasty}</span>`;
                        }
                        if(author.address){
                            authorHtml +=  ` 住址<span>${author.address}</span>`;
                        }
                        $("#author").html(authorHtml);
                        let poetryHtml = "";
                        let poetryList = res.poetryList;
                        if(poetryList){
                            for(let i = 0, j = poetryList.length; i < j; i ++){
                                let poetry = poetryList[i];
                                poetryHtml += `<span class="href-next" onclick="poetryDetailById(${poetry.id})">${poetry.title}</span><br>`;
                            }
                        }
                        $("#poetry").html(poetryHtml);
                    }else{
                        tipsMessage(json);
                    }
                }
            });
        }
    </script>
</head>
<body>
    <object class="object-top" data="/page/common/top"></object>
    <h1 class="title-h1">作者简介</h1>
    <div id="author" class="author-div"></div>
    <h1 class="title-h1">作品列表</h1>
    <div id="poetry" class="content-div"></div>
</body>
</html>